package me.firstapp.config;

import javax.servlet.MultipartConfigElement;
import javax.servlet.ServletRegistration.Dynamic;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

public class WebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

	@Override
	protected Class<?>[] getRootConfigClasses() {
		return new Class<?>[] { RootConfig.class };
	}

	@Override
	protected Class<?>[] getServletConfigClasses() {
		return new Class<?>[] { WebConfig.class };
	}

	@Override
	protected String[] getServletMappings() {
		return new String[] { "/", "*.do" };
	}

	@Override
	protected void customizeRegistration(Dynamic registration) {
		String path = "tmp"+System.getProperty("file.separator")+"firstapp"+System.getProperty("file.separator")+"uploads";
		registration.setMultipartConfig(new MultipartConfigElement(path, 2097152, 4194304, 0));
	}

}
